Helpful Information
 
 
Category: ODBC
Problem with PHP > ODBC > M$ Access - Need to rewrite date.

I'm having problems with adding a date to an M$ Access database through PHP>ODBC which I think is because of the format of the date.
So I presume that rewriting the date would solve it but I have no experience/knowledge with doing this and this is what I need help with.

Also I don't know what format the date should be changed to, although I think it has to be "2003-01-01 00:00:00" since that is what it returns when I retrieve a record from the DB.

Anyway If someone could help me with changing the format from "DD/MM/YYY" to "YYYY-MM-DD HH:MM:SS". The HH:MM:SS part will always be 00:00:00.

I have no code to post since it's not a problem with the existing code. What I would like is if someone could either post a link where I can learn how do to this or prefferably post an example I can adapt to my needs.

Just to clarify again what exacly I need to do is change
$JobEndDate = "21/01/2003"
to
$JobEndDate = "2003-01-21 00:00:00"

Also in case it matters the date will be posted from a form.

I would much appreciate some help.
TIA

What about something like:


list($day,$month,$year) = split('/',$JobEndDate);
$JobEndDate = "$year-$day-$month 00:00:00";

Thanks for that.

It works perfectly. Unfortunatly now I'm getting other data mismatch errors. Damn access.










privacy (GDPR)